/*
 * Droplet.cpp
 *
 * Created: 5/11/2012 4:13:57 PM
 *  Author: common
 */ 

#include <avr/io.h>
#include <math.h>
#include <util/delay.h>

#include "motor.h"
#include "RGB_LED.h"
#include "pc_com.h"

int main(void)
{
	motor_init();
	RGB_LED_init();
	pc_com_init();
	
	char i = 'a';
	
	printf("Press any key to pause/unpause. \n");
	while (1)
	{
		if (PC_USART.STATUS & USART_RXCIF_bm)
		{
			i = PC_USART.DATA;
			printf("Paused (%c) ", i);
			while (!(PC_USART.STATUS & USART_RXCIF_bm));	
			i = PC_USART.DATA;
		}
		set_green_led(100);
		printf("%c ", i++);
		if (i > 'z') i = 'a';
		_delay_ms(100);
		set_green_led(0);
		_delay_ms(500);
	}	
}